#include "physics/pstar.h"

#include <QDomElement>

PStar::PStar(PWorld *world, QString name) : PObject(world, QString("star_") + name)
{
    setM(100);
    setR(10);
    setDamage(1000000);
    setBrightness(40);
    setLife(10000000);
}

void PStar::serialize(QDomDocument *doc, QDomElement *e) const {
    e->setAttribute("type", "Star");
    PObject::serialize(doc, e);
}

PStar *PStar::deserialize(QDomNode *node, PWorld *parent) {
    PObject *obj = PObject::deserialize(node, 0);
    PStar *star = new PStar(parent, obj->getName());
    star->setBrightness(obj->getBrightness());
    star->setDamage(obj->getDamage());
    star->setLife(obj->getLife());
    star->setM(obj->getM());
    star->setPos(obj->getPos());
    star->setR(obj->getR());
    star->setV(obj->getV());

    delete obj;
    return star;
}
